<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content=" initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title><#$shopinfo[0]['shopname']#></title>
<link rel="stylesheet" href="<#$Theme['P']['js']#>/jquerymobile/jquery.mobile-1.3.2.min.css">
<link rel="stylesheet" href="<#$Theme['T']['css']#>/login.css">
<script type="text/javascript" src="<#$Theme['P']['js']#>/jquery.js"></script>
<script type="text/javascript" src="<#$Theme['P']['js']#>/jquerymobile/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript" src="<#$Theme['T']['js']#>/api.js"></script>
<title></title>

</head>
<body>
<include  file="public:head"/>

<div class="formbox">
<form name="regform">

<div data-role="fieldcontain">
    <label for="txt_user">用户名:</label>
    <input type="text" name="txt_user" id="txt_user" placeholder="请输入用户名" value="">
</div>
	<div data-role="fieldcontain">
   <label for="password">密码:</label>
	<input type="password" name="password" id="password"  placeholder="请输入密码" value="" autocomplete="off">
	
</div>
	<div data-role="fieldcontain">
   <label for="phone">手机号码:</label>
	<input type="tel" name="phone" id="phone" value="" placeholder="请输入手机号码" autocomplete="off" maxlength="11">
	
</div>
	<div data-role="fieldcontain">
   <label for="qq">QQ:</label>
	<input type="tel" name="qq" id="qq" value="" placeholder="请输入QQ号码" autocomplete="off" maxlength="15">
	
</div>
<div class="tips" id="tips"></div>
<a href="#" data-role="button" data-theme="a" id="btn_reg">注册</a>
		<a href="#" data-role="button" data-theme="c" id="btn_back">返回首页</a>
	</form>
</div>

<script>
	var bajax=false;
	$(document).ready(function(){
		$("#btn_reg").bind('click',function(){
			var u=$('#txt_user').val();
			var p=$('#password').val();
			var m=$('#phone').val();
			var q=$('#qq').val();
			 if (u == "") {
				 
			        Tips("tips", "请输入用户名", true, 1000);
			    	
			        return false;
			 }
			  if (p == "") {
				
				  Tips("tips", "请输入密码", true, 1000);
			        return false;
			  }
			  if (m == "") {
				 
				  Tips("tips", "请填写有效的11位手机号码", true, 1000);
			        return false;
			  }
			  if (q == "") {
				 
				  Tips("tips", "请输入QQ号码", true, 1000);
			        return false;
			  }
			  if(m.length!=11){
				
				  Tips("tips", "输入的手机号码位数不正确", true, 1000);
			        return false;
			   }
			  if(q.length<5){
				  
				  Tips("tips", "请填写有效的QQ号码", true, 1000);
			        return false;
			   }
			   if(bajax){
				   Tips("tips", "正在注册中，请耐心等待几秒..", true, 1000);
			        return false;
				  }
			  bajax=true;
			  $.ajax({
				  	url: '<#:U('userauth/regu')#>',
			        type: "post",
					data:{
						'user':u,
						'password':p,
						'phone':m,
						'qq':q,
						'__hash__':$('input[name="__hash__"]').val()
						},
					dataType:'json',
					error:function(){
							bajax=false;
							 Tips("tips", "服务器忙，请稍候再试", true, 1500);
							},
					success:function(data){
								bajax=false;
							if(data.error==0){
								Tips("tips", "注册成功", false, 1500);
								setTimeout("goUrl('"+data.url+"')",1500);
							}else{
								Tips("tips", data.msg, true, 1500);
							}
					}
				  });

		});
		$('#btn_back').bind('click',function(){
			history.go(-1);
		});
	});

	function goUrl(url){
		location.href=url;
	}
</script>
</body>
</html>